#!/bin/bash
target=$((RANDOM % 100 + 1))
echo "猜数字   输入1-100之间的数字"
while true; do
    read guess
    if [ $guess -eq $target ]; then
        echo "正确答案是 $target"
        exit
    elif [ $guess -lt $target ]; then
        echo "猜小了   再试一次"
    else
        echo "猜大了   再试一次"
    fi
done